-
Notifications
You must be signed in to change notification settings - Fork 84
feat(l2): monitor for ethrex L2 #3410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Lines of code reportTotal lines added: Detailed view
|
- create `widget` directory - move widgets to single filles into `widget` directory - implement `run` and `start` methods in `EthrexMonitor` - centralize clippy expects and add a todo to handle them - rename `tabs` dir to `tab`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a real‐time terminal monitor for the L2 sequencer, exposing metrics and chain state via a TUI.
- Introduces a
--monitor
flag to enable the EthrexMonitor in the L2 sequencer. - Adds a new
monitor
module undercrates/l2
with widgets, utils, and a terminal app (EthrexMonitor
). - Extends RPC types and clients (
block
,mempool
,eth client
) to support monitoring (e.g.,node_status
, public fields).
Reviewed Changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
crates/l2/sequencer/mod.rs | Hook up start_monitor when cfg.monitor.enabled |
crates/l2/monitor/widget/tabs.rs | Defines tab state for the monitor UI |
crates/l2/monitor/mod.rs | Sets up start_monitor function and Clippy attributes |
crates/l2/monitor/widget/blocks.rs | Renders the latest L2 blocks table |
crates/common/types/transaction.rs | Changes serialized JSON field from "from" to "sender" |
Comments suppressed due to low confidence (5)
crates/l2/monitor/widget/tabs.rs:4
- Typo in enum name
TabsSate
; it should beTabsState
to accurately reflect 'State'.
pub enum TabsSate {
crates/l2/monitor/widget/blocks.rs:145
- [nitpick] Variable
blob_bas
is unclear; consider renaming toblob_gas
orblob_size
to match its meaning.
.map(|(number, n_txs, hash, coinbase, gas, blob_bas, size)| {
crates/common/types/transaction.rs:278
- Changing the JSON field from
"from"
to"sender"
is a breaking change for any consumers; consider documenting this or bumping the serialization version.
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
crates/common/types/transaction.rs:287
- [nitpick] The error message format was corrected to include a colon. Ensure consistency across other error messages or add tests to cover this formatting.
}
crates/l2/monitor/mod.rs:2
- Rust lints use
allow
,warn
, ordeny
—expect
is not a recognized lint level. Replace#![expect(...)]
with#![allow(clippy::expect_used)]
.
#![expect(clippy::expect_used)]
This reverts commit 47609be.
This reverts commit e9b48ed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! just some comments
**Description** This PR introduces de ethrex monitor. A currently optional tool for node operators to monitor the L2 state. The node can be monitored in two different tabs, the Overview tab and the Logs tab. Both tabs have a help text line at the bottom to let know the user how to interact with the current tab. The Overview tab is composed of: - An ASCII ethrex logo. - A node status widget - A general chain status widget, which lists: - Current batch (the batch being built by the Sequencer). - Current block (the block being built by the Sequencer). - Last committed batch. - Last committed block. - Last verified batch. - Last verified block. - An L2 batches widget, which lists the last 50 L2 batches and their current status, highlighting: - L2 batch number. - Number of blocks in the batch. - Number of L2 to L1 messages in the batch. - Commit tx hash (if committed). - Verify tx hash (if verified). - An L2 blocks widget, which lists the last 50 L2 blocks, highlighting: - L2 block number. - Number of txs in the block. - L2 block hash. - L2 block coinbase (probably more relevant in based rollups). - Gas consumed. - Blob gas consumed. - Size of the block. - A mempool widget, which lists the current 50 txs in the memool, highlighting: - Tx type (e.g. EIP1559, Privilege, etc). - Tx hash. - Tx sender. - Tx nonce. - An L1 to L2 messages widget, which lists the last 50 L1 to L2 msgs and their status, highlighting: - Message kind (e.g. deposit, message, etc). - Message status (e.g. Processed on L2, etc). - Message L1 tx hash. - Message L2 tx hash - Value - An L2 to L1 messages widget, which lists the last 50 L2 to L1 msgs and their status, highlighting: - Message kind (e.g. withdrawal, message, etc). - Message status (e.g. initiated, claimed, sent, delivered). - Receiver on L1. - Token L1 (if ERC20 withdrawal). - Token L2 (if ERC20 withdrawal). - L2 tx hash - Value The Logs tab shows the logs altogether or by crate. The log level could also be adjusted in runtime. > [!NOTE] > 1. This feature is introduced as optional for now given its initial state. Once mature enough, it will be default for operators. > 2. This initial version has some minor known flaws, but they were skipped in this PR on purpose: > - lambdaclass#3512 . > - lambdaclass#3513. > - lambdaclass#3514. > - lambdaclass#3515. > - lambdaclass#3516. > - No optimizations were done. **How to test** 1. Add `--monitor` to the `init-l2-no-metrics` target in `crates/l2/Makefile`. 2. Run a Sequencer (I suggest `make restart` in `crates/l2`). 3. Run the prover with `make init-prover` in `crates/l2`. 4. Run `make test` in `crates/l2`. **Showcase** *Overview* <img width="1512" alt="image" src="https://github.com/user-attachments/assets/0431b1f3-1a8f-49cf-9519-413ea3d3ed1a" /> *Logs* <img width="1512" alt="image" src="https://github.com/user-attachments/assets/e0e6cdd7-1f8d-4278-8619-475cfaa14d4b" />
Description
This PR introduces de ethrex monitor. A currently optional tool for node operators to monitor the L2 state.
The node can be monitored in two different tabs, the Overview tab and the Logs tab. Both tabs have a help text line at the bottom to let know the user how to interact with the current tab.
The Overview tab is composed of:
The Logs tab shows the logs altogether or by crate. The log level could also be adjusted in runtime.
Note
EthrexMonitor
process to usespawn
#3515.How to test
--monitor
to theinit-l2-no-metrics
target incrates/l2/Makefile
.make restart
incrates/l2
).make init-prover
incrates/l2
.make test
incrates/l2
.Showcase
Overview
Logs